<template>
	<view class="item" @click="onClickItem()">
		<view class="left">
			<image class="icon" src="https://snpl.scgjcx.com/static/pos.png"></image>
			<view class="name">{{ device.name }}</view>
			<view class="addr">{{ device.addr }}</view>
		</view>
		<view class="right">
			<text >{{ device.num }}个设备</text>
			<text class="ws">{{ device.workingStatus ? '工作中' : '已停止' }}</text>
		</view>
	</view>
</template>

<script>
	export default {
		name:"item",
		props: {
			device: {
				type: Object,
				default: function () {
					return {};
				}
			}
		},
		
		data() {
			return {
				
			};
		},
		mounted() {
			console.log('item', this.device);
		},
		methods: {
			onClickItem() {
				uni.navigateTo({
					url: `/pages/device/index?name=${this.device.name}&id=${this.device.id}`
				});
			}
		}
		
	}
</script>

<style lang="less" scoped>
	.item {
		background-color: #fff;
		border-radius: 5px;
		box-sizing: border-box;
		padding: 15px 25px 20px;
		margin-bottom: 10px;
		display: flex;
		box-shadow: 0 0 2px 2px rgba(153,153, 153, 0.2);
		
		.icon {
			width: 38px;
			height: 38px;
		}
		
		.name {
			color: rgb(130, 129, 134);
			font-size: 18px;
		}
		
		.addr {
			color: rgb(176, 176, 176);
			font-size: 12px;
		}
		
		.right {
			width: 100px;
			text-align: right;
			color: rgb(186, 186, 186);
			font-size: 14px;
			display: flex;
			//justify-content: space-between;
			flex-direction:column;
			.ws {
				//margin-left: 10px;
				color: #EEB61B;
			}
		}

	}
</style>